package com.shanxia.codec.enums;

import java.util.Objects;

public enum ChargingPatternEnum {

    CONSTANT_VOL(0x01, "恒压充电"),
    CONSTANT_CURRENT(0x02, "恒流充电"),
    UNKNOWN(99, "未知");

    public static ChargingPatternEnum getByCode(int code) {
        for (ChargingPatternEnum enums : ChargingPatternEnum.values()) {
            if (Objects.equals(enums.code, code)) {
                return enums;
            }
        }
        return ChargingPatternEnum.UNKNOWN;
    }

    ChargingPatternEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int code;
    public String name;
}
